<?php
/**
 * Created by IntelliJ IDEA.
 * User: wanglu
 * Date: 17/4/12
 * Time: 17:43
 */
class Project_content_temp_model extends BaseModel {


    function __construct()
    {
        parent::__construct(Db_model::TABLE_PROJECT_CONTENT_TEMP);
    }

    public function batch_insertcontents($contents = array()) {

        return $this->db->insert_batch(Db_model::TABLE_PROJECT_CONTENT_TEMP, $contents);
    }

    public function get_temp_contents($pid, $lang_id) {
            return $this->db->select(Db_model::TABLE_PROJECT_KEY . ".pkey, display_order, limit_length, remark, ".Db_model::TABLE_PROJECT_CONTENT_TEMP . ".content")
            ->from(Db_model::TABLE_PROJECT_KEY)
            ->join(Db_model::TABLE_PROJECT_CONTENT_TEMP, Db_model::TABLE_PROJECT_KEY.'.pkey='.Db_model::TABLE_PROJECT_CONTENT_TEMP.'.pkey', 'left')
            ->order_by(Db_model::TABLE_PROJECT_KEY . ".display_order", "ASC")
            ->order_by(Db_model::TABLE_PROJECT_KEY . ".createtime", "ASC")
            ->where(Db_model::TABLE_PROJECT_KEY. ".pid", $pid)
            ->where(Db_model::TABLE_PROJECT_CONTENT_TEMP. ".lang_id", $lang_id)
            ->get()->result_array();
    }
}